package table_walker;

import java.io.BufferedReader;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import DFA.DFA;

@SuppressWarnings("unused")
public class TableWalker {
	BufferedReader br;
	public TableWalker(String filename) throws FileNotFoundException{
		br=new BufferedReader(new FileReader(filename));
	}
	
	public List<List<String>> walk() throws IOException{
		List<List<String>> twoDim = new ArrayList<List<String>>();
		String token;
		String tokenText="";
		
		int c=br.read();
		
		while(c!=-1){
			char in=(char)c;
			tokenText+=in;
			if(!Character.isWhitespace(in) && in!='\n' && in!='\r' && in!='\t' && in!='\b' && in!='\f'){
				token=readNext(in);
				if(token!=null){
					twoDim.add(Arrays.asList(tokenText,token));
					tokenText="";
				}
			}
			c=br.read();
		}
		token=lastToken();
		twoDim.add(Arrays.asList(tokenText,token));
		return twoDim;
	}
	//Dummy Methods readNext and lastToken to prevent errors during code commit
	public String readNext(char c){
		return "";
	}
	public String lastToken(){
		return "";
	}
}
